package com.wz.project.system.prjgroup.Repository;

import com.wz.project.system.dept.domain.Dept;
import com.wz.project.system.prjgroup.domain.Prjgroup;
import com.wz.project.system.prjgroup.entity.PrjgroupEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Collection;
import java.util.List;

/**
 * @author zn kai
 * @create 2021-08-17 9:26
 */
public interface PrjgroupRepository extends JpaRepository<PrjgroupEntity, Integer> {


    @Query(value = "select * from sys_prjgroup  where 1=1 and (prjgroup_name=:#{#p.prjgroupName} or :#{#p.prjgroupName} is null) ", nativeQuery = true)
    List<PrjgroupEntity> findALlPrjgroup(@Param("p") Prjgroup prjgroup);



    @Query(value = "select * from sys_dept d where d.dept_id in :s", nativeQuery = true)
    List<Dept> findByDeptIn(@Param("s") Collection<Integer> strings);

}
